package com.movie.controller;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.movie.comm.utils.PageData;
import com.movie.db.util.DBHelper;


@WebServlet("/test")
public class TestAction extends HttpServlet {
	private static final long serialVersionUID = 1L;
    
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//测试用的没有加上Dao层   不推荐使用
		String sql ="select * from class";
		DBHelper dbHelper = new DBHelper();
		List<Map<String,Object>> result = dbHelper.getSimpleObjs(sql, null);
		PageData pageData = new PageData(request);
	    pageData.get("hobby");
		request.setAttribute("userList", result);
		request.getRequestDispatcher("FetchMapDemo.jsp").forward(request, response);
		
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
